--[[/**
-- * 
 * 静电--条件1
 * 
-- *
-- */]]

---@class BuffEffect425100 : BaseBuffEffect
BuffEffect425100 = ClientFight.CreateClass("BuffEffect425100", ClientFight.BaseBuffEffect)
local t = BuffEffect425100

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local prob = buff.buffBean.f_BuffEffectValue[1];
    local hpRatio = buff.buffBean.f_BuffEffectValue[2];
    local addProb = buff.buffBean.f_BuffEffectValue[3];

    local fighter = buff.source;
    local maxHp = FighterAttributeManager.getFightAttr(fighter, FighterAttributeEnum.HP);

    local reduceHp = maxHp - fighter.hp;
    if (reduceHp > 0)then
        prob = prob + ( reduceHp / maxHp * 10000 / hpRatio) * addProb;
   end

    local random = fight:random( Global.TEN_THOUSANDTH);
    if (random > prob)then
    fight.log("{} 计算者：{}，计算后机率：{}，命中失败", buff, fighter, prob);
    return IBuffEffect.FAIL;
   end
    fight.log("{} 计算者：{}，计算后机率：{}，命中成功，", buff, fighter, prob);

    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()